const upload = {
  upload(req, res) {
    let response = {}
    if (req.file) {
      response = {
        code: 0,
        msg: '文件上传成功',
        data: {
          filename: req.file.filename
        }
      }
    } else {
      response = {
        code: 1,
        msg: '上传文件错误',
        data: {
          filename: ''
        }
      }
    }
    res.send(response)
  }
}
module.exports = upload
